#include"comm.h"

int main()
{
  key_t k = ftok(PATHNAME, PROJ_ID);
  //printf("key :%d\n", k);

  int shmid = shmget(k, SIZE, 0);
  if(shmid<0){
    perror("shmget");
    return 1;
  }
  //printf("shmid:%d\n", shmid);

  char  *str = (char*)shmat(shmid, NULL, 0);
  printf("shmid: %d %s\n", shmid, str);

  //char c = 'a';
  //for(;c<='z';c++){
  //  str[c-'a']=c;
  //  sleep(5);
 //}
  

  const char * msg = "I am client Process A\n";
  int len = strlen(msg);
  int i = 0;
  printf("len :%d\n",len);
  while(1){
    for(i =0;i < len;++i)
    {
      str[i]=msg[i];
     // sleep(1);
    }
    //str[64]="say process a\n";
    sleep(1);
  }

  return 0;
}
